//
//  PublicMethod.h
//  PlamBaida
//
//  Created by zp on 13-4-22.
//  Copyright (c) 2013年 zp. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "UIImageView+WebCache.h"
#import "UIButton+WebCache.h"


@interface PublicMethod : NSObject

//加载loading动画
+(UIImageView *)startAnimation;

//货主版进入token失效时，进入新主页
+(void)enterNewMain;


//获取手机名
+(NSString *)getDeviceName;

//获取手机型号
+(NSString *)getDevicePlatform;

//获取设备自定义UUID
+ (NSString *)identifierForVendorOfUUIDString;

+(NSString *)getRandomStringWithLength:(NSInteger)length;

//unicode转化为中文
+ (NSString *)replaceUnicode:(NSString *)unicodeStr;

//判断字符是否是中文
+(BOOL)isChinese:(NSString *)string;

//隐藏多余的tableview分割线
+ (void)setExtraCellLineHidden:(UITableView *)tableView;

//根据图片比例和实际的高度或者宽度，获取实际的宽度或者高度
+ (float)getScaleValueWithImage:(NSString *)imageName withHeight:(float)height orWithWidth:(float)width;

//压缩/拉伸 图片
+ (UIImage*)imageWithImageSimple:(UIImage*)image scaledToSize:(CGSize)newSize;

//图片等比缩放
+(UIImage *) scaleImage:(UIImage *)image toScale:(float)scaleSize;


//判断字符串是否全为空格
+ (BOOL)checkStrings:(NSString*)str;

//url中汉字转换成UTF8编码
+ (NSURL *)URLWithBaseString:(NSString *)baseString parameters:(NSDictionary *)parameters;

//估算字符串行高
+ (CGSize)textSizeOfString:(NSString *)text width:(CGFloat)width font:(UIFont *)font;

//图片拉伸方法
+ (UIImage *)resizeImageWithCapInsets:(UIEdgeInsets)capInsets withImage:(UIImage *)theImage;

//拨打电话
+ (void)callPhoneNum:(NSString *)phone;

//图片加载等待
+ (void)waitImageView:(UIImageView *)view withURL:(NSString *)imageHttp withPlaceholderImage:(UIImage *)placeholder;
//button图片加载等待
+ (void)waitButton:(UIButton *)button withURL:(NSString *)imageHttp withPlaceholderImage:(UIImage *)placeholderImage;

//利用正则表达式验证邮箱
+ (BOOL)isValidateEmail:(NSString *)email;

//利用正则表达式验证手机号
+ (BOOL)isValidateTel:(NSString *)tel;

//利用正则表达式验证ip
+ (BOOL)isValidateIP:(NSString *)ip;

//16进制颜色(html颜色值)字符串转为UIColor @"FFF666"
+(UIColor *) hexStringToColor: (NSString *) stringToConvert;

//获取当前日期时间字符串
+(NSString *) getNowDateTimeString;

//获取当前日期字符串
+(NSString *) getNowDateString;

//获取当前时间字符串
+(NSString *) getNowTimeString;

//字符串转化为NSDate
+(NSDate *) dateFromString:(NSString *)dateStr;

//把数据分类
+ (NSArray *) dealDataWithArray:(NSArray *)array;

//获取日期中的年
+ (NSInteger) yearFromDate:(NSDate *)date;

//获取日期中的月份
+ (NSInteger) monthFromDate:(NSDate *)date;

//获取日期中的日期
+ (NSInteger) dayFromDate:(NSDate *)date;

//在日期date经过day天之后的日期
+ (NSString *) theDate:(NSString *)date afterDays:(NSInteger)day;

//是否包含中文
+ (BOOL)isIncludeChineseInString:(NSString*)str;

//URLEncoded
+ (NSString *)URLEncodedString:(NSString *)string;

//URLDecode
+ (NSString *)URLDecodedString:(NSString *)string;

@end
